<?php
/**
 * Created by PhpStorm.
 * User: lyb
 * 超时产品类（计划任务）
 * Date: 2017/1/4
 * Time: 11:35
 */

class TimeoutProduct extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->model('scheduled_model');
    }

    /**
     * 超时检测
     */
    public function TimeoutDetection(){
        $time=120;
        $data=$this->scheduled_model->getProduct(array(18,2,10));
        foreach($data as $row){
            $timeDifference=time()-$row['add_time'];
            if($timeDifference > $time){
                $this->common_model->update('mt_product',array('overtime_status'=>1),array('id'=>$row['id']));
            }
        }
        echo 'ok';
    }
}